import java.util.Scanner;

public class circulationexe {
    public static void main13(String[] args) {
        //求平均值
        Scanner scanner = new Scanner(System.in);
        int sum = 0;
        int num = 0;
        while(scanner.hasNextInt()) {
            int tmp = scanner.nextInt();
            sum += tmp;
            num++;
        }
        System.out.println("sum = "+sum);
        System.out.println("avg = "+sum/num);
        scanner.close();//使用后关闭
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
//        while(scanner.hasNextLine()) {//每次读入一行
        while(scanner.hasNext()) {//读到空格便停止本次读入
            String str = scanner.next();
//           int i = scanner.nextInt();
            int j = scanner.nextInt();
            System.out.println(str);
            System.out.println(j);
//            System.out.println(i);
        }
        scanner.close();
    }

    public static void main11(String[] args) {
        //打印1-100的素数
        for (int i = 1; i <= 100; i++) {
            int k = 2;
            for (k = 2; k <= Math.sqrt(i); k++) {
                if(i % k == 0) {
                    //System.out.println("不是素数");
                    break;
                }
            }
            if(k > Math.sqrt(i)) {
                System.out.println(i + "是素数");
            }
        }
    }
    public static void main10(String[] args) {
        //判断素数（法1）
        int n = 7;
        int i = 2;
        for (; i < n ; i++) {
            if(n % i == 0) {
                System.out.println("不是素数");
                break;
            }
        }
        if(i == n) {
            System.out.println("是素数");
        }
        //法2
        int j = 2;
        for (j = 2; j <= n/2 ; j++) {
            if(n % j == 0) {
                System.out.println("不是素数");
                break;
            }
        }
        if(j > n/2) {
            System.out.println("是素数");
        }
        //法3
        int k = 2;
        for (k = 2; k <= Math.sqrt(n); k++) {
            if(n % k == 0) {
                System.out.println("不是素数");
                break;
            }
        }
        if(k > Math.sqrt(n)) {
            System.out.println("是素数");
        }
    }

    public static void main9(String[] args) {
        //判断一个数的奇数位和偶数位是0或是1，并打印出来
        int n = 7;
        //偶数位
        for (int i = 31; i >= 1; i -= 2) {
            System.out.print(((n >> i) & 1 )+ " ");
        }
        System.out.println();
        //奇数位
        for (int i = 30; i >= 0 ; i -= 2) {
            System.out.print(((n >> i) & 1) + " " );
        }
    }


    public static void main8(String[] args) {
        //编写代码模拟三次密码输入的场景，最多能输入三次密码，密码正确，提示”登陆成功“，
        //密码错误，可以重新输入，最多输入三次，三次均错，则提示退出程序
        Scanner scanner = new Scanner(System.in);
        int count = 3;
        while(count != 0) {
            System.out.println("请输入密码,你还有" + count + "次机会");
            String password = scanner.nextLine();//输入密码（一行）
            //if(password == "123") 这种比较字符串的方法是错误的，类比c语言
            if(password.equals("123")){//equals是java中比较字符串是否相等的方法
                System.out.println("密码正确");
            }else {
                System.out.println("密码错误");
            }
            count--;
            if(count == 0) {
                System.out.println("由于您错误次数太多，自动退出程序");
            }
        }

    }

    public static void main7(String[] args) {
        //输出一个整数的每一位
        //法1
//        int i;
//        Scanner scanner = new Scanner(System.in);
//        while(scanner.hasNextInt()) {
//            int n = scanner.nextInt();
//            for (i = n; i >9 ; i /= 10) {
//                int num = i %10;
//                System.out.println(num);
//            }
//            System.out.println(i);
//        }
        //法2
        int n = 123;
        while(n != 0) {
            System.out.println(n %10);
            n /=10;
        }
    }


    public static void main6(String[] args) {
        //乘法口诀表
        Scanner scanner = new Scanner(System.in);
        while(scanner.hasNextInt()) {
            int n = scanner.nextInt();
            for (int i = 1; i <= n; i++) {
                for (int j = 1; j <= i ; j++) {
                    System.out.print(i+" * "+ j +" = " + i * j +"  ");
                }
                System.out.println();
            }
        }
    }


    public static void main5(String[] args) {
        //打印x型
        Scanner scanner = new Scanner(System.in);
        //多组输入
            while (scanner.hasNextInt()) {

              int n = scanner.nextInt();//输入一个整数
                for (int i = 0; i < n; i++) {
                    for (int j = 0; j < n; j++) {
                        if ((i == j) || (j + i == n - 1)) {//对角线判断，满足时打印*
                            System.out.print("*");
                        } else {
                            System.out.print(" ");//不满足打印空格
                        }
                    }
                    //打印一行后换行
                    //System.out.println();ok
                    System.out.print("\n");//ok
                }
            }
        }



    public static void main4(String[] args) {
        //计算时刻（包括负数转为正数）
        int num = -11;
        int n = (num%12+12)%12;

    }

    public static void main3(String[] args) {
        //水仙花数
        for (int i = 1; i <= 999999; i++) {
            int count = 0;
            int tmp = i;
            int sum = 0;
            while(tmp != 0) {
                tmp /= 10;
                count++;//计算幂次数
            }
            tmp = i;
            while(tmp != 0) {
                //计算每位数的幂次方和
                sum += Math.pow(tmp % 10,count);//这里强转为int
                tmp /= 10;
            }
            if(sum == i) {
                System.out.println(i);
            }
        }
    }

    public static void main2(String[] args) {
        //计算分数的值
        double sum = 0.0;
        int flag = 1;//控制正负号
        for (int i = 1; i <= 100 ; i++) {
            //sum = sum + 1/i;err
            sum = sum + 1.0/i * flag;
            flag = -flag;
        }
        System.out.println(sum);
    }

    public static void main1(String[] args) {
        //求一个整数，在内存的当中存储时，二进制1的个数
        //写法3(每次&一次比值少一的数，二进制就少一个1）
        int n = 15;
        int count = 0;
        while(n != 0) {
            n = n & (n-1);
            count++;
        }
        System.out.println(count);

        //写法2
        int num = 10;
        count = 0;
        while(num != 0) {
            if((num & 1) !=0) {
                count++;
            }
            num = num >>> 1; //无符号右移，这样便可不用每次都进行32次判断
        }
        System.out.println(count);
        //写法1
//        Scanner scanner = new Scanner();
         n = 10;
         count = 0;
        for (int i = 0; i < 32; i++) {
            if(((n >> i) & 1) == 1) {
                count++;
            }
        }
        System.out.println(count);
    }
}
